import Vue from 'vue'
import Router from 'vue-router'
import HelloWorld from '@/components/HelloWorld'
import Re from '@/ly/re.vue'
import Sr from '@/ly/src.vue'
import Jd from '@/yg/lb.vue'
import Xq from '@/yg/xq.vue'
import Ks from '@/yg/ks.vue'
import Tz from '@/yg/jwtz.vue'
import Io from '@/yg/tz.vue'
import Bm from '@/yg/bm.vue'
import Bd from '@/yg/jwbaidu.vue'
import Du from '@/yg/baiduxq.vue'
import To from '@/yg/toDoList.vue'
import Li from '@/yg/toDoz.vue'
import Ci from '@/elm/city.vue'
import Sw from '@/components/Swp.vue'
import Sp from '@/components/jdzz.vue'
import Da from '@/components/data.vue'
import Ad from '@/components/add.vue'
import Bu from '@/components/bus.vue'
import Bx from '@/components/busxq.vue'
import Bf from '@/components/busfa.vue'
import Ve from '@/vuex/vxfa.vue'
import Vd from '@/vuex/vxda.vue'
import Va from '@/vuex/vxab.vue'
import So from '@/vuex/sop.vue'
import Mt from '@/meituan/mt.vue'
// import Md from '@/meituan/mymaindata.vue'
const Md = () => import('@/meituan/mymaindata.vue')
import Lm from '@/meituan/lsmt.vue'
import Cy from '@/ly/re.vue'
import By from '@/ly/src.vue'
import B1 from '@/ly/B1.vue'
import B2 from '@/ly/B2.vue'
import B3 from '@/ly/B3.vue'
const Fa = () => import('@/ly/fa.vue')
import Sy from '@/ly/sy.vue'
import Fl from '@/ly/fl.vue'
import Gw from '@/ly/gw.vue'
const Lw = () => import('@/ly/sw.vue')
const Lo = () => import('@/meituan/mtLogin.vue')
const My = () => import('@/meituan/mtsy.vue')
const De = () => import('@/meituan/de.vue')
const Kp = () => import('@/keepAlive/keepAlive.vue')
const La = () => import('@/yg/loca.vue')
const Dr = () => import('@/自定义指令/dr.vue')
const Gl = () => import('@/过滤器/gl.vue')
const Se = () => import('@/$set方法/ste.vue')
const Nx = () => import('@/$nextTick方法/next.vue')
const Ny = () => import('@/$nextTick方法/next异步原理.vue')
import Ji from '@/components/jia.vue'
import Cisc from '@/elm/citySearch.vue'
import Cm from '@/components/Coma.vue'
//@符号代表src
Vue.use(Router)
const router = new Router({
  //routes 路由规则
  routes: [
    {
      path: '/www',  //链接路径
      component: Fa, //对应的组件模板
      children: [    //子组件
        { name: "sy", path: "/Sy", component: Sy },
        {
          name: "fl",
          path: "/Fl",
          component: Fl,
          redirect: "/b1",  //路由重定向
          children: [
            { name: "b1", path: "/b1", component: B1 },
            { name: "b2", path: "/b2", component: B2 },
            { name: "b3", path: "/b3", component: B3 }
          ]
        },
        {
          name: "gw", path: "/Gw", component: Gw,
          meta: { isAll: true }
        },
      ]
    },
    {
      path: '/Lw',
      component: Lw
    },
    {
      path: '/md',
      component: Md
    },
    {
      path: '/',
      component: Lo,
      name:"Lo",
    },
    {
      path: '/my',
      component: My,
      meta: { isAll: true },
      name:"Lo",
    },
    {
      path: '/de',
      component: De,
    },
    {
      path: '/dr',
      component: Dr,
    },
    {
      path: '/gl',
      component: Gl,
    },
    {
      path: '/se',
      component: Se,
    },
    {
      path: '/nx',
      component: Nx,
    },
    {
      path: '/ny',
      component: Ny,
    },
    {
      meta:{o:false},
      path: '/ci',
      component: Ci,
    },
    {
      path: '/tr',
      meta:{p:1},
      component: r => require.ensure([], () => r(require('@/tran/tran.vue')), 'demo1'),
    },
  
  ],
  // linkActiveClass:"active"  更改router-link样式
  // mode:"history" //默认路径是哈希值就是带#号的路径，这里可以改成history
})

// //全局前置路由守卫-----每次路由切换之前调用
// router.beforeEach((to, from, next) => {
//   var s=1
//   if(to.meta.isAll){
//     if(s===0){
//        next()
//     }else{
//       alert("去不了")
//     }
//   }else{ 
//     next()
//   }
// })




// //全局前置路由守卫-----每次路由切换之前调用
// router.afterEach((to, from) => {
// })
// router.beforeEach((to, from, next) => {
//   var pob=to.query.pob
//   var bool=to.query.bool
//   var check=to.query.check
//   if (to.meta.isAll) {
//     if (bool=="true"  && pob=="true" && check=="true") {
//       next()
//     }
//     else if(to.query.tel=="" && to.query.posw==""){
//       next("/de")
//     }
//      else {
//       alert("您的用户名或密码错误，需要重新登录")
//     }
//   } else {
//     next()
//   }
// })

export default router